/// configured options are:
///
/// * build.jobs
+/// * build.target
/// * target.$target.ar
/// * target.$target.linker
/// * target.$target.libfoo.metadata
None => None,
};
let jobs = jobs.or(cfg_jobs).unwrap_or(::num_cpus::get() as u32);
+ let cfg_target = try!(config.get_string("build.target")).map(|s| s.0);
+ let target = target.or(cfg_target);
let mut base = ops::BuildConfig {
jobs: jobs,
requested_target: target.clone(),
jobs = 1 # number of jobs to run by default (default to # cpus)
rustc = "rustc" # the rust compiler tool
rustdoc = "rustdoc" # the doc generator tool
+target = "triple" # build for the target triple
target-dir = "target" # path of where to place all generated artifacts
```
execs().with_status(0));
});
+test!(simple_cross_config {
+ if disabled() { return }
+
+ let p = project("foo")
+ .file(".cargo/config", &format!(r#"
+ [build]
+ target = "{}"
+ "#, alternate()))
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.0"
+ authors = []
+ build = "build.rs"
+ "#)
+ .file("build.rs", &format!(r#"
+ fn main() {{
+ assert_eq!(std::env::var("TARGET").unwrap(), "{}");
+ }}
+ "#, alternate()))
+ .file("src/main.rs", &format!(r#"
+ use std::env;
+ fn main() {{
+ assert_eq!(env::consts::ARCH, "{}");
+ }}
+ "#, alternate_arch()));
+
+ let target = alternate();
+ assert_that(p.cargo_process("build").arg("-v"),
+ execs().with_status(0));
+ assert_that(&p.target_bin(&target, "foo"), existing_file());
+
+ assert_that(process(&p.target_bin(&target, "foo")),
+ execs().with_status(0));
+});
+
test!(simple_deps {
if disabled() { return }